﻿@{
    ViewBag.Navi = "#ui-order";
    Layout = "~/Views/Shared/_User.cshtml";
    string ordertype = ViewBag.OrderType.ToString();
}
<div class="myhome_center" style="width: 720px;">
    <div class="full">
        <div class="tou">
            <h2>
                我的订单</h2>
        </div>
        <div class="form">
            <div class="introduc_info-usr">
                <div class="tab2_area">
                    <ul class="tab2_head">
                        @Html.OrderListTab(ordertype)
                    </ul>
                </div>
                <div class="tab2_container">
                    @if (ordertype == "tobepaid")
                    {         
                    
     
                        @(Html.Telerik().Grid<dynamic>()
                            .Name("Grid")
                            .Columns(c =>
                            {
                                c.Bound("OrdersID")
                                    .ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= OrdersID #>' title='选中/反选' />")
                                    .HeaderTemplate(
                                        @<text>
                                        <input type="checkbox" title="全选/反选" id="checkAllRecords" />
                                        </text>
                                    )
                                    .Width(50)
                                    .HeaderHtmlAttributes(new { style = "text-align:center" })
                                    .HtmlAttributes(new { style = "text-align:center" });


                                c.Bound("CardName")
                                    .ClientTemplate(@"
<div class='pic-order'><img src='/content/images/photo/<#= Photo #>' alt='<#= CardMemo #>'></div>
<div>
<a href='/commodity/<#= CardKey #>'><#= CardName #></a>
<p><#= CardMemo #></p>
</div>")
                                       .Width(280)
                                        .Title("商品信息");

                                c.Bound("OrdersID").Title("订单号")
                                    .ClientTemplate("<a href='/user/order/detail/<#= OrdersID #>'><#= OrdersID #></a>")
                                    .HtmlAttributes(new { @class = "list_order" });


                                c.Bound("TotalPrice").Title("价格")
                                    .Format("￥{0}")
                                    .HtmlAttributes(new { @class = "list_total" });

                                c.Bound("OrderCreateTime")
                                    .Title("订单日期")
                                    .Format("{0:yyyy-MM-dd HH:mm}");

                                c.Bound("PayStatus").Title("订单状态")
                                    .ClientTemplate("未支付");

                                c.Bound("OrdersID").ClientTemplate(@"
                                    <input id='btnPay' type='submit' value='支付' class='btnPay ui-icons' />
                                    <input id='btnClose' type='reset' value='关闭' class='btnClose ui-icons' />")
                                    .Title("操作")
                                    .Width(100)
                                    .HtmlAttributes(new { @class = "list_operation" })
                                    .FooterTemplate(
                                        @<text>
                                        <input id='btnPay' type='submit' value='合并支付' class='ui-icons' style="background-position: -6px -181px;" />
                                        </text>
                                    );


                            })
                                                        .DataBinding(binding => binding.Ajax().Select("_GetOrdersByCustomer", "Order"))
                                                        .Sortable()
                                                        .Pageable(p => p.PageSize(5))

                                                 )

                     
                   
                    }
                    else if (ordertype == "paid")
                    {

                     
     
                        @(Html.Telerik().Grid<dynamic>()
                            .Name("Grid")
                            .Columns(c =>
                            {
                           

                                c.Bound("CardName")
                                    .ClientTemplate(@"
<div class='pic-order'><img src='/content/images/photo/<#= Photo #>' alt='<#= CardMemo #>'></div>
<div>
<a href='/commodity/<#= CardKey #>'><#= CardName #></a>
<p><#= CardMemo #></p>
</div>")
                                       .Width(280)
                                        .Title("商品信息");

                                c.Bound("OrdersID").Title("订单号")
                                    .ClientTemplate("<a href='/user/order/detail/<#= OrdersID #>'><#= OrdersID #></a>")
                                    .HtmlAttributes(new { @class = "list_order" });


                                c.Bound("TotalPrice").Title("价格")
                                    .Format("￥{0}")
                                    .HtmlAttributes(new { @class = "list_total" });

                                c.Bound("OrderCreateTime")
                                    .Title("订单日期")
                                    .Format("{0:yyyy-MM-dd HH:mm}");

                                c.Bound("PayStatus").Title("订单状态")
                                    .ClientTemplate("已支付");

                                c.Bound("OrdersID").ClientTemplate(@"
                                    <input id='btnPay' type='submit' value='再次购买' class='btnPay ui-icons' />")
                                    .Title("操作")
                                    .Width(100)
                                    .HtmlAttributes(new { @class = "list_operation" });


                            })
                                                        .DataBinding(binding => binding.Ajax().Select("_GetOrdersByCustomer", "Order"))
                                                        .Sortable()
                                                        .Pageable(p => p.PageSize(5))

                                                 )

                     
                       
                        
                    }
                    else if (ordertype == "cancelled")
                    {
                     
                    
     
                        @(Html.Telerik().Grid<dynamic>()
                            .Name("Grid")
                            .Columns(c =>
                            {
                               

                                c.Bound("CardName")
                                    .ClientTemplate(@"
<div class='pic-order'><img src='/content/images/photo/<#= Photo #>' alt='<#= CardMemo #>'></div>
<div>
<a href='/commodity/<#= CardKey #>'><#= CardName #></a>
<p><#= CardMemo #></p>
</div>")
                                       .Width(280)
                                        .Title("商品信息");

                                c.Bound("OrdersID").Title("订单号")
                                    .ClientTemplate("<a href='/user/order/detail/<#= OrdersID #>'><#= OrdersID #></a>")
                                    .HtmlAttributes(new { @class = "list_order" });


                                c.Bound("TotalPrice").Title("价格")
                                    .Format("￥{0}")
                                    .HtmlAttributes(new { @class = "list_total" });

                                c.Bound("OrderCreateTime")
                                    .Title("订单日期")
                                    .Format("{0:yyyy-MM-dd HH:mm}");

                                c.Bound("PayStatus").Title("订单状态")
                                    .ClientTemplate("已取消");

                                c.Bound("OrdersID").ClientTemplate(@"
                                    <input id='btnPay' type='submit' value='重新购买' class='btnPay ui-icons' />")
                                    .Title("操作")
                                    .Width(100)
                                    .HtmlAttributes(new { @class = "list_operation" });


                            })
                                                        .DataBinding(binding => binding.Ajax().Select("_GetOrdersByCustomer", "Order"))
                                                        .Sortable()
                                                        .Pageable(p => p.PageSize(5))

                                                 )

                     
                        
                    }
                </div>
            </div>
        </div>
    </div>
</div>
